function genSaveKey (key, vm) {
  return vm.gameID + (vm.lotteryType || '') + key
}

export function setItem (key, val, vm) {
  if (!vm) {
    throw new Error('[localStorage] vue instance not found!')
  }
  localStorage.setItem(genSaveKey(key, vm), val)
}

export function getItem (key, vm) {
  if (!vm) {
    throw new Error('[localStorage] vue instance not found!')
  }
  return localStorage.getItem(genSaveKey(key, vm))
}
